<script setup lang="ts">
import {testApi, userLogin} from "../interface.ts";

const login = () => {
  userLogin('guang',  '111111').then(res => {
    console.log(res)
    const { userInfo, accessToken, refreshToken } = res.data;
    console.log(userInfo)

    localStorage.setItem('access_token', accessToken);
    localStorage.setItem('refresh_token', refreshToken);
  })
}

const test = () => {
  testApi().then(res => {
    console.log(111, res)
  })
}

const moreTest = async () => {
  const res = await [testApi(), testApi(), testApi()]
  console.log('group: ', res)
}

</script>

<template>
  <div>
    <button @click="login">Login</button>

    <button @click="test">TestApi</button>

    <button @click="moreTest">一组API</button>
  </div>
</template>

<style scoped>
.read-the-docs {
  color: #888;
}
</style>
